1. Field of the Invention
The present invention relates to a data processing device and method, and more particularly, to a data processing device and method capable of minimizing compiling time.
2. Description of the Related Art
In the field of computers, a virtual machine is a term used by Sun Microsystems, Inc., a developer of the JAVA (a registered trademark of Sun Microsystems, Inc.) language and the execution environment therefor, and is software serving as an interface between a compiled JAVA binary code and a microprocessor (or a hardware platform) actually executing a command of a program. When a JAVA virtual machine is provided on a single platform, any JAVA program called a bytecode can be executed on the platform. JAVA is designed to allow application programs to be executed on any platform without having to be reconstructed or compiled in conformity with the platform.
JAVA programming languages have proliferated rapidly since they were published in the middle of 1990's but were disadvantageous in that their codes have a slow operating speed compared to the codes composed by other programming languages such as C or C++. In order to overcome this disadvantage, two techniques applicable to a conventional interpreter-based JAVA virtual machine have been previously proposed: one is a dynamic code generation technique such as a Just-In-Time (JIT) compiler and the other is a static code generation technique such as an Ahead-Of-Time (AOT) compiler.
The JAVA platform basically comprises a JAVA virtual machine and JAVA classes. Class files are composed of information associated with data structures of the classes, including field information, method information, and so on. Execution codes of a method are formed of the bytecode, independent of hardware or an operating system.
As shown in FIG. 1, such JAVA virtual machine includes a JAVA virtual machine runtime 10, an operating system layer 20, a hardware layer 30, a class loader 40, an execution engine 50 and a garbage collector 60. The virtual machine runtime manages necessary resources such as memory, threads, and networks using interface with lower layers, i.e., the operating system layer 20 and the hardware layer 30. The class loader 40 converts a class corresponding to a program module written in JAVA into a form that can be executed by the JAVA virtual machine and loads the converted class onto memory. The execution engine 50 executes an execution code of a JAVA class. The garbage collector 60 collects unnecessary memories among memories used during the execution of an application and returns them to the JAVA virtual machine runtime 10 to be reused.
On the basis of the execution engine, the conventional JAVA virtual machine can be classified into an interpreter-based JAVA virtual machine, a JIT compiler-based JAVA virtual machine, a JAVA virtual machine using the interpreter-based and JIT compiler-based JAVA virtual machines, an AOT compiler-based JAVA virtual machine, and so on.
The interpreter-based JAVA virtual machine interprets the bytecodes of the method intended for execution one by one, thereby performing an application.
The JIT compiler obtains a machine language code dependent on the current JAVA platform by compiling the bytecodes, and then executes the machine language code to conduct an application.
Although the JIT compiler provides better performance than the interpreting method, compiling time is included in application execution time since compiling is performed at a method execution time. To overcome this disadvantage, an AOT compiler performs compiling before the application execution begins because compiling time is regarded as part of the method execution time.
FIG. 2 illustrates a method of translating a bytecode into a machine language code using a compiler.
In operation S10, the compiler analyzes the bytecode and collects data needed to generate the machine language code.
Here, the data needed to generate the machine language code includes a type of command obtained by analyzing the bytecode and a use frequency of the command.
In operation S20, the compiler allocates a register for the command based on the collected data. In operation S30, the compiler generates the machine language code.
In operation S40, the machine language code is recorded in predetermined memory and then is executed.
When the compiler generating the machine language code as described above, compile performance is greatly influenced by the manner of allocating a register on which an operation is performed fastest within a processor.
In detail, local register allocation or global register allocation is performed according to a type of command. The local register allocation is performed in units of basic blocks while the global register allocation is performed in units of methods.
In other words, a register is allocated for a basic block in the local register allocation and is allocated for a method in the global register allocation.
A command for loading onto a register and a command for moving to a memory must be respectively added to the front and the back of each of the basic block and the method. Accordingly, performance is decreased with respect to a stack slot beyond a register allocation unit, i.e., the basic block or the method when the local register allocation or the global register allocation is used.
Korean Patent Publication No. 2001-0104687 discloses a hardware JAVA accelerator which implements a part of a JAVA virtual machine in hardware to accelerate system operations related with JAVA bytecodes. The disclosed hardware JAVA accelerator accelerates an operating speed but does not prevent performance from decreasing with respect to a stack slot beyond a register allocation unit, i.e., a basic block or a method during compiling.